<?php 
require_once($_SERVER['DOCUMENT_ROOT']."/classes/Account.class.php");
session_start(); 
require_once("includes/sugar.php");
require_once("includes/errmess.php");
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Humeur - Une humeur, une couleur</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script src="js/ajaxLoader.js"></script>
<script src="js/ajaxResponses.js"></script>
</head>

<body>
	<header><img src="img/logo.png" alt="logo"/></header>
	<h1>Une humeur = une couleur !</h1>
    <div id="content">
    	<div id="errorMessages" class="centered"><?php if(isset($_GET['errcode'])) echo getErrMess($_GET['errcode']);?></div>
    	<?php 
			if(!isset($_GET['module'])){ 
				include("modules/accueil.php");
			}elseif(file_exists("modules/".$_GET['module'].".php")){ 
				if($_GET['module'] != "accueil" && $_GET['module'] != "install"){
					checkConnection();
				}
				include("modules/".$_GET['module'].".php");
			}else{
				include("modules/404.php");
			}
		?>
    </div>
    <footer>Humeurs - Une couleur pour une humeur - &copy; Copyright 2013-2014 - <?php
	$db = new HumeurDatabase();
	$nbAccounts = mysql_fetch_assoc($db->query("SELECT COUNT(*) FROM accounts"));
	$nbMembers = mysql_fetch_assoc($db->query("SELECT COUNT(*) FROM members"));
	echo $nbAccounts["COUNT(*)"]." comptes inscrits, pour ".$nbMembers["COUNT(*)"]." membres !";
	?></footer>
</body>
</html>